home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-04-21 | 3.0 KB | 121 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: TextUtil.cpp
- // Release Version: $ 1.0d1 $
- //
- // Author: Anthone Burbidge
- // Creation Date: 3/28/94
- //
- // Copyright: © 1993, 1994 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef _TEXTUTIL_
- #include "TextUtil.h"
- #endif
-
- #ifndef _TEXTFACET_
- #include "TextFacet.h"
- #endif
-
- #ifndef _TEXTFRAME_
- #include "TextFrame.h"
- #endif
-
- #ifndef _TEXTPART_
- #include "TextPart.h"
- #endif
-
- #ifndef _ODTEXT_
- #include "ODText.h"
- #endif
-
- #ifndef FWRECT_H
- #include "FWRect.h"
- #endif
-
- // ----- Textension Includes -----
-
- #ifndef _TextensionCommon_
- #include "TextensionCommon.h"
- #endif
-
- #ifndef _Textension_
- #include "Textension.h"
- #endif
-
- // ----- OpenDoc Includes -----
-
- #ifndef _WINDOW_
- #include "Window.h"
- #endif
-
- // ----- Macintosh Includes -----
-
- #ifndef __FIXMATH__
- #include <FixMath.h>
- #endif
-
- #ifndef mathRoutinesIncludes
- #include <Math Routines.h>
- #endif
-
- #pragma segment TextPartSegment
-
-
- //===================================================================================================
- // CLASS CTextDrawInitiator
- //===================================================================================================
-
- //---------------------------------------------------------------------------------------------------
- // CTextDrawInitiator::CTextDrawInitiator
- //---------------------------------------------------------------------------------------------------
-
- CTextDrawInitiator::CTextDrawInitiator(CTextFacet *facet, XMPShape* clipShape) :
- FW_CGraphicContext(facet->GetXMPFacet(), clipShape)
- {
- CTextFrame *frame = (CTextFrame *) facet->GetFrame();
- CTextPart *part = (CTextPart *) frame->GetPart();
-
- CTextension* textEdit = part->GetEditText();
-
- // ----- Set to the facet's port.
-
- XMPWindow *xmpWindow = facet->GetXMPWindow();
- WindowPtr window = xmpWindow->GetPlatformWindow();
- textEdit->SetTextPort(window);
- // textEdit->SetTextPort(facet->GetXMPWindow()->GetPlatformWindow());
-
- FW_CRect bounds;
- frame->GetFrameShapeBounds(&bounds);
-
- // ----- Set the view rect. This is just like the view rect in TE.
-
- FW_SPlatformRect qdBounds;
- bounds.AsPlatformRect(qdBounds);
- textEdit->SetViewRect(&qdBounds);
-
- // ----- Set the frame size. This is similar to the dest rect in TE.
-
- bounds.Inset(CTextFrame::kBorderInset, CTextFrame::kBorderInset);
-
- LongPoint frameSize(FixedToInt(bounds.Width()), 0/*0 means unlimited hite*/);
-
- CFrames* frames = textEdit->GetFramesHandler();
-
- CDisplayChanges displayChanges;
- frames->SetTextFrameSize(&frameSize, &displayChanges);
-
- // ------ Reflow the text if necessary.
-
- short action = textEdit->DisplayChanged(&displayChanges);
- }
-
- //---------------------------------------------------------------------------------------------------
- // CTextDrawInitiator::~CTextDrawInitiator
- //---------------------------------------------------------------------------------------------------
-
- CTextDrawInitiator::~CTextDrawInitiator()
- {
- }
-